package cn.snowheart.decorator.starbucks;

import cn.snowheart.decorator.starbucks.beverage.BaseBeverage;
import cn.snowheart.decorator.starbucks.beverage.DarkRoast;
import cn.snowheart.decorator.starbucks.beverage.Espresso;
import cn.snowheart.decorator.starbucks.beverage.HouseBlend;
import cn.snowheart.decorator.starbucks.condiment.Milk;
import cn.snowheart.decorator.starbucks.condiment.MilkFoam;
import cn.snowheart.decorator.starbucks.condiment.Mocha;
import cn.snowheart.decorator.starbucks.condiment.SoyMilk;

/**
 * @author liuwanxiang
 * @version 2019/06/27
 */
public class StarBucksTests {

    public static void main(String[] args) {

        // 顾客一：浓缩+牛奶
        BaseBeverage custom1 = custom1();
        print(custom1);

        // 顾客二：深焙+摩卡
        BaseBeverage custom2 = custom2();
        print(custom2);

        // 顾客三：全都要
        BaseBeverage custom3 = custom3();
        print(custom3);

    }

    private static BaseBeverage custom1() {
        BaseBeverage result;

        // 浓缩咖啡加牛奶
        result = new Espresso();
        result = new Milk(result);

        return result;
    }

    private static BaseBeverage custom2() {
        BaseBeverage result = new DarkRoast();
        result = new Mocha(result);
        return result;
    }

    private static BaseBeverage custom3() {
        BaseBeverage result = new HouseBlend();
        result = new Milk(result);
        result = new MilkFoam(result);
        result = new Mocha(result);
        result = new SoyMilk(result);
        return result;
    }

    private static void print(BaseBeverage beverage) {
        System.out.println(beverage.getDescription());
        System.out.println(beverage.cost());
        System.out.println("--------------------");
    }

}
